import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/agreement_entity.dart';

AgreementEntity $AgreementEntityFromJson(Map<String, dynamic> json) {
  final AgreementEntity agreementEntity = AgreementEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    agreementEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    agreementEntity.msg = msg;
  }
  final AgreementData? data = jsonConvert.convert<AgreementData>(json['data']);
  if (data != null) {
    agreementEntity.data = data;
  }
  return agreementEntity;
}

Map<String, dynamic> $AgreementEntityToJson(AgreementEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.toJson();
  return data;
}

extension AgreementEntityExtension on AgreementEntity {
  AgreementEntity copyWith({
    int? code,
    String? msg,
    AgreementData? data,
  }) {
    return AgreementEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

AgreementData $AgreementDataFromJson(Map<String, dynamic> json) {
  final AgreementData agreementData = AgreementData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    agreementData.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    agreementData.title = title;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    agreementData.content = content;
  }
  return agreementData;
}

Map<String, dynamic> $AgreementDataToJson(AgreementData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['content'] = entity.content;
  return data;
}

extension AgreementDataExtension on AgreementData {
  AgreementData copyWith({
    int? id,
    String? title,
    String? content,
  }) {
    return AgreementData()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..content = content ?? this.content;
  }
}